﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace rndbuddy
{
    public partial class override_key : Form
    {
        public override_key()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string apikey = textBox1.Text.Trim();
            bool valid = server_pipe.validate_api_key(apikey);
            if (valid)
            {
                settings.api_key = apikey;
                settings.storeConfig();
                settings.parseConfig();
                MessageBox.Show("Key validated, please restart Honorbuddy");
                this.Dispose();
                return;
            }

            MessageBox.Show("This key is not valid, please try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return;
        }
    }
}
